package com.pubinfo.passbook.common.enums;

import com.pubinfo.passbook.common.exception.ServiceException;
import com.pubinfo.passbook.common.model.vo.base.BusinessErrorCode;
import lombok.Getter;

/**
 * 合同状态枚举
 */
@Getter
public enum ContractTypeEnum {
  
  TRIAL(0, "试用数据"),
  FORMAL(1, "正式生产数据"),
  ;
  
  private Integer code;
  
  private String desc;
  
  ContractTypeEnum(Integer status, String desc) {
    this.code = status;
    this.desc = desc;
  }

    public static ContractTypeEnum getEnum(Integer status) {
        for (ContractTypeEnum e : ContractTypeEnum.values()) {
            if (status.equals(e.getCode())) {
                return e;
            }
        }
        throw new ServiceException(BusinessErrorCode.STATUS_NOT_EXIST);
    }

}
